#{extends 'CRUD/layout.html' /}
#{set title:messages.get('analysissubtype.edit') /}

<div id="crudShow" class="${type.name}">

    <h2 id="crudShowTitle">&{'analysissubtype.edit'}</h2>

    <div class="objectForm">
    #{form action:@save(object._key()), enctype:'multipart/form-data'}
        #{crud.form fields:['analysisSubTypeName', 'analysis', 'analysisDetails']}
        	#{crud.custom 'analysisDetails'}
	    		<label for="${analysisDetails}"><a href="@{AnalysisDetails.list()}" class="nonUnderlined">&{'objects.analysisdetails'}</a></label>
	    		%{analysisDetails = models.AnalysisDetail.find("byAnalysisSubType", object).fetch()}%
	    		#{if analysisDetails != null && !analysisDetails.isEmpty() }
    			<div class="list">
					#{list items:analysisDetails, as:'detail'}
						<li>
							<span id="${detail.analysisDetailId}" class="hiddenLinks">
								@{AnalysisDetails.show(detail.analysisDetailId)}
					        </span>
				        	${detail.analysisDetailName}
				        </li>
				    #{/list}
			    </div>
	    		#{/if}
	    		#{else}
					&{'crud.list.empty'}	    		
	    		#{/else}
        	#{/crud.custom}
        #{/crud.form}
        <p class="crudButtons">
            <input type="submit" name="_save" value="&{'crud.save', type.modelName}" />
            <input type="submit" name="_saveAndContinue" value="&{'crud.saveAndContinue', type.modelName}" />
        </p>
    #{/form}
    </div>

    #{form @delete(object._key())}
        <p class="crudDelete">
            <input type="submit" value="&{'analysissubtype.delete'}" onclick="return confirm('&{'analysissubtype.delete'}')"/>
        </p>
    #{/form}

</div>